package com.base.cn.platform.os.controller.manage;

import com.base.cn.platform.os.common.constants.ConfigName;
import com.base.cn.platform.os.common.utils.result.ResultUtil;
import com.base.cn.platform.os.controller.cmmon.ApiBaseController;
import com.base.cn.platform.os.service.manage.config.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.TreeMap;

/**
 * 系统配置接口
 *
 * @author s.li
 * @create 2018-08-30-15:45
 */
@RestController
@RequestMapping("/api/config")
public class ApiConfigController extends ApiBaseController {

    @Autowired
    private SysConfigService sysConfigService;

    /**
     * 检测App更新接口
     * @return Map<String,Object>
     */
    @RequestMapping("/checkVersion")
    public Map<String,Object> checkVersion(){
        TreeMap<String,String> configMap = sysConfigService.getSysConfigContext(ConfigName.APP);
        return ResultUtil.SUCCESS(configMap);
    }

    /**
     * 获取隐私协议
     * @return Map<String,Object>
     */
    @RequestMapping("/protocol")
    public Map protocol(){
        TreeMap<String,String> configMap = sysConfigService.getSysConfigContext(ConfigName.PIVACY);
        return ResultUtil.SUCCESS("获取成功 ",configMap.get("content"));
    }
}
